<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                >

    <f:subview id="cadastroQuestaoEditarEmbutido" rendered="#{fluxoExibicaoCadastro.exibirCadastroQuestaoEdicao}">
        <h:panelGrid columns="1" id="embCadQuesEdit" width="850" styleClass="center">
            <h:form id="formTableQuestoes">
              <p:dataTable value="#{questaoRespostaEditar.questoesModel}" var="questao" id="tableQuestoes" rows="5" paginator="true"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks}
                                 {NextPageLink} {LastPageLink}" styleClass="bvb-font"
                                 emptyMessage="#{msg.semRegistrosEcontrados}" 
                                 >
                        <f:facet name="header">
                            <h:outputText value="#{msg.richTableQuestoes}"/>
                        </f:facet>

                        <p:column id="col1" styleClass="center" style="width: 65px;" filterBy="#{questao.id}" headerText="Model" footerText="contains"
                                  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnId}"/>
                            </f:facet>
                            <h:outputText value="#{questao.id}" styleClass="bvb-font"/>
                        </p:column>

                        <p:column id="col2" filterBy="#{questao.enunciado}" headerText="Model" footerText="contains"
                                  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnEnunciado}"/>
                            </f:facet>
                            <h:inputTextarea cols="25" rows="3" disabled="true" value="#{questao.enunciado}" style="font-size: 10px;"/>
                        </p:column>

                        <p:column id="col8" filterBy="#{questao.objetivoCertificacao}" headerText="Model" footerText="contains"
                                  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnObjetivo}" />
                            </f:facet>
                            <h:inputTextarea cols="25" rows="3" disabled="true" value="#{questao.objetivoCertificacao}" style="font-size: 10px;"/>
                        </p:column>

                        <p:column id="col10" styleClass="center" filterBy="#{questao.versoesString}" headerText="#{msg.richColumnVersoes}" 
                                  filterMatchMode="contains" >
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnVersoes}"/>
                            </f:facet>
                            <h:outputText value="#{questao.versoesString}" styleClass="bvb-font"/>
                        </p:column>
                  
                         <p:column id="col11" styleClass="center" >
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnTipoQuestao}"/>
                            </f:facet>
                            <h:outputText value="#{msg[questao.tipoQuestao.labelTQ]}" styleClass="bvb-font"/>
                        </p:column>

                        <p:column id="col9" styleClass="center" style="width: 65px;">
                            <f:facet name="header">
                                <h:outputText value="#{msg.richColumnEditar}"/>
                            </f:facet>
                            <p:commandLink update="conteudoCentralGroup,messages" title="#{msg.titleButtonPegaQuestaoVersao}" 
                                           id="buttonEditar" styleClass="ui-button_link">
                                <h:graphicImage library="img" name="questao_24_edit.png"/>
                                <f:setPropertyActionListener value="#{questao}" target="#{questaoRespostaEditar.questaoManipulada}" />  
                            </p:commandLink>
                        </p:column>
                    </p:dataTable>    
            </h:form>
            
            <p:spacer width="100%" height="15"/>
            
             <h:panelGroup id="grupCadQuestaoVer" styleClass="esquerda">
                <h:form id="formEditRespostar" styleClass="formularioFundo">
                    
                    <h:panelGroup id="groupRespostas" rendered="#{questaoRespostaEditar.questaoManipulada != null}" >
                        <p:dataTable value="#{questaoRespostaEditar.respostas}" var="resposta" styleClass="bvb-font">
                            <p:column styleClass="center" style="width: 75px;">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.posicao}" title="#{msg.titleOrdemResposta}" id="labelOrdem"/>
                                </f:facet>
                                <h:outputText value="#{resposta.ordem}ª" title="#{msg.titleOrdemResposta}" styleClass="blue"/>
                            </p:column>

                            <p:column styleClass="center" style="width: 75px;">
                                <f:facet name="header">
                                    <h:outputText value="#{msg.correta}" id="labelCorreta" title="#{msg.titleCorretaResposta}"/>
                                </f:facet>
                                <h:selectBooleanCheckbox value="#{resposta.correta}" id="ordem" title="#{msg.titleCorretaResposta}"
                                                         label="#{msg.correta}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                    <span id="resmsg"></span>
                                    <h:outputText value="  #{msg.resposta}" id="labelResposta" title="#{msg.titleRespostaQuestao}"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:inputTextarea value="#{resposta.resposta}" label="#{msg.resposta}" style="font-size: 10px;"
                                                 cols="45" rows="3" id="inputResposta"   required="true"
                                                 title="#{msg.titleRespostaQuestao}" onkeyup="Contar(this.value, 'resmsg', 250)">
                                    <f:validateLength minimum="1" maximum="250"/>
                                </h:inputTextarea>
                                <p:message for="inputResposta"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <span id="comentmsg"></span>
                                    <h:outputText value="  #{msg.comentario}" id="labelComentario" title="#{msg.titleComentarioResposta}"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:panelGroup>
                                    <h:inputTextarea value="#{resposta.comentario}" label="#{msg.comentario}"
                                                     cols="45" rows="3" id="inputComentario" required="true"
                                                     title="#{msg.titleComentarioResposta}" style="font-size: 10px;"
                                                     onkeyup="Contar(this.value, 'comentmsg', 150)">
                                        <f:validateLength minimum="5" maximum="150"/>
                                    </h:inputTextarea>
                                    
                                        <p:message for="inputComentario"/>
                                    
                                </h:panelGroup>
                            </p:column>
                        </p:dataTable>
                        <h:panelGrid columns="3" cellspacing="2">
                            <p:commandLink actionListener="#{questaoRespostaEditar.salvarQuestao}" update="conteudoCentralGroup,messages"
                                           title="#{msg.titleButtonSalvarQuestao}" id="buttonSalvar" styleClass="ui-button_link">
                                <h:graphicImage library="img" name="bt_salvar.png"/>
                            </p:commandLink>
                        </h:panelGrid>
                    </h:panelGroup>
                </h:form>
            </h:panelGroup>
        </h:panelGrid>

    </f:subview>
</ui:composition>
